package com.cookman.gameobjects.decks;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.cookman.assets.AssetMap;
import com.cookman.assets.AssetsImpl;
import com.cookman.assets.AssetsLocator;
import com.cookman.gameobjects.DiseaseDistributionActor;
import com.cookman.utils.Constants;

/**
 * Created by Cookman on 16.09.14.
 */
public class DiseaseDistributionDeckActor extends Group {

    private float scale = 0.34f;
    private Sprite background = AssetsLocator.getSpriteByAtlasRegion(AssetsImpl.MAP, AssetMap.BIOHAZARDPANEL);

    public DiseaseDistributionDeckActor() {
        super();
        this.setWidth(2.5f);
        double h=(2.5*background.getHeight())/background.getWidth();
        this.setHeight((float)h);
    }

    public void setDistribution(int distribution) {
        clearChildren();

        float xPos = 0f;

        for (int i = 0; i < distribution; i++) {
            DiseaseDistributionActor actor = new DiseaseDistributionActor();
            actor.setX(xPos);
            actor.setY(0.08f);
            actor.setScale(scale);
            addActor(actor);
            xPos += scale+0.015f;
        }
    }

    public void draw(Batch batch, float parentAlpha) {
        batch.draw(background, this.getX(), this.getY(), this.getWidth(), this.getHeight());
        super.draw(batch, parentAlpha);
    }
}
